package com.collection;

import java.util.ArrayList;
import java.util.List;

/**
 * 沙鼠
 */
public class Gerbil {
    public static void main(String[] args) {
        List<Gerbil> gerbils = new ArrayList<>();
        gerbils.add(new Gerbil(1));
        gerbils.add(new Gerbil(2));
        gerbils.add(new Gerbil(3));
        gerbils.add(new Gerbil(4));
        gerbils.add(new Gerbil(5));
        gerbils.add(new Gerbil(6));
        gerbils.add(new Gerbil(7));
        for (int i = 0; i < gerbils.size(); i++) {
            Gerbil gerbil = gerbils.get(i);
            gerbil.hop();
        }
    }
    private final int gerbilNumber;

    public Gerbil(int gerbilNumber) {
        this.gerbilNumber = gerbilNumber;
    }

    /**
     * 沙鼠跳跃的动作
     */
    public void hop() {
        System.out.println("Gerbil" + gerbilNumber + " hops");
    }
}
